package com.itcast.activiti.service;

import com.itcast.activiti.domain.AddSign;
import com.itcast.activiti.domain.RemoveSign;
import com.itcast.activiti.domain.TaskStart;
import com.itcast.activiti.utils.ActivitiPage;
import org.activiti.engine.task.Attachment;
import org.activiti.engine.task.Task;

import java.util.List;
import java.util.Map;

public interface ITaskRuntimeService {

    // 查询当前业务Key指派人对应任务
    ActivitiPage listTaskPage(ActivitiPage activitiPage);

    // 代理人任务
    List<Map<String, Object>> listMapTask(List<Task> taskList);

    // 获取任务
    List<Task> listTask(String tenantId, String businessKey, String assignee);

    List<Task> listTaskByProcessInstanceId(String processInstanceId);

    // 任务审批
    String completeTaskApply(String tenantId, String businessKey, String assignee, TaskStart taskStart, Integer applyType);

    // 任务审批(自动完成审批人相同的相邻节点)
    String autoNextCompleteTaskApply(String tenantId, String businessKey, String assignee, TaskStart taskStart, Integer applyType, String lastTaskId);

    // 获取意见
    List<Map<String, Object>> listComment(String taskId);

    // 获取附件
    List<Attachment> listTaskAttachments(String taskId);

    // 判断任务是否是 知会节点，如果是，则自动完成并跳过
    List<Task> listJudgeAndComplateNotifyTask(List<Task> tasks);

    // 转交/归还
    String transferTask(String tenantId, String businessKey, String assignee, String assigneeOther);

    // 委托
    String delegatedTask(String tenantId, String businessKey, String assignee, String delegatedAssignee);

    // 加签
    String addSign(String tenantId, String businessKey, String assignee, AddSign addSign);

    // 减签
    String removeSign(String tenantId, String businessKey, String assignee, RemoveSign removeSign);

    // 获取当前任务的信息
    Map<String, Object> current(String tenantId, String businessKey, String assignee);
}
